<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/view/common/includes.jsp" %>
<%@ include file="/WEB-INF/view/inc.jsp" %>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<style>
    .panel-body {
        border-bottom-width: 0px;
        border-left-width: 0px;
    }

    .layout-expand .panel-header {
        border-width: 0px;
    }

</style>
<body class="easyui-layout" data-options="fit:true,border:false">
<!-- 搜索框 -->
<div data-options="region:'north',title:'查询条件',border:false" style="height:80px; overflow: hidden;border: 0px;">
    <form id="searchForm">
        <div class="fitem fl">
            <label>食材名称:</label>
            <input name="ingredientName" class="easyui-textbox">
            <input name="cookbookId" type="hidden" value="${cookbookId}" >
        </div>
        <div class="fitem searchItem fr">
            <a class="easyui-linkbutton" iconCls="icon-search" onclick="sy_searchFun()">搜索</a>
            <a class="easyui-linkbutton" iconCls="icon-reload" onclick="sy_resetFun()">重置</a>
        </div>
    </form>
</div>
<div data-options="region:'center',border:false">
    <table id="grid" class="easyui-datagrid" fit="true"
           data-options="url:'<%=contextPath%>/ingredients/list',method: 'post',pagination: true,queryParams: {	cookbookId: '${cookbookId}'},
            rownumbers:true,idField: 'id', fitColumns:true,singleSelect:true,striped:true,sortName:'createTime',sortOrder:'desc',toolbar: '#toolbar'">
        <thead>
        <tr>
            <th data-options="field:'ingredientName'" width="100" sortable="true">食材名称</th>
            <th data-options="field:'ingredientCount'" width="100" sortable="true">数量</th>
            <th data-options="field:'sort'" width="100" sortable="true">排序</th>
        </tr>
        </thead>
    </table>
</div>
<!-- 按钮-->
<div id="toolbar" style="display: none;">
    <t:button action="ingredients_add" iconCls="icon-add" buttonName="新增" onclick="sy_addFun('/ingredients/toSaveAndUpdate/'+'${cookbookId}','添加Ingredients信息',600,800)"/>
    <t:button action="ingredients_edit" iconCls="icon-edit" buttonName="编辑" onclick="sy_editFun('/ingredients/toSaveAndUpdate/'+'${cookbookId}','修改Ingredients信息',600,800)"/>
    <t:button action="ingredients_remove" iconCls="icon-remove" buttonName="删除" onclick="sy_removeGridFun_tip('/ingredients/delete')"/>
</div>
<script>
    var $grid;
    var $form;
    var cookbookId = '${cookbookId}';
    /**
     * 分页查询重置
     * @param grid
     */
    var sy_resetFun = function ($grid, $form) {
        if (!$grid) {
            $grid = $("#grid");
        }
        if (!$form) {
            $form = $("#searchForm");
        }
        $form.form('clear');
        $("input[name=cookbookId]").val(cookbookId);
        $grid.datagrid('load', {cookbookId:cookbookId});
        $grid.datagrid('clearSelections');
        $grid.datagrid('clearChecked');
    }

</script>
</body>
</html>



